#ifdef MBM_IMIBASE_SUPPORT
#include "mbm_spreadtrum_inc.h"

#include "mbm_typedefine.h"
#include "mbm_sys_adapter.h"
#include "mbm_vui_adapter.h"


#include "mbm_am_adapter.h"

//macro
//#define MBM_DEBUG_AM

#if defined(MBM_DEBUG_AM)
#define AM_TRACE mbm_trace
#else
#define AM_TRACE 
#endif

//extern variable

//extern function

//static or gloable variable
static t_mbm_keyhandler g_am_key_handler = NULL;
static t_mbm_tphandler g_am_tp_handler = NULL;
static t_mbm_applet_state_handler g_am_state_handler = NULL;

//static function
void mbm_am_reg_key_handler(t_mbm_keyhandler hdr)
{
	g_am_key_handler = hdr;
}

void mbm_am_excute_key_handler(Int32 key_event, Int32 key_code)
{
	AM_TRACE("mbm_am_excute_key_handler");
	if(g_am_key_handler != NULL)
	{
		g_am_key_handler(key_event, key_code);
	}
}

void mbm_am_reg_tp_handler(t_mbm_tphandler hdr)
{
	g_am_tp_handler = hdr;
}

void mbm_am_excute_tp_handler(Int32 tp_event, Int32 x, Int32 y)
{
	AM_TRACE("mbm_am_excute_tp_handler");
	if(g_am_tp_handler != NULL)
	{
		g_am_tp_handler(tp_event, x, y);
	}
}

void mbm_am_reg_state_handler(t_mbm_applet_state_handler hdr)
{
	g_am_state_handler = hdr;
}

void mbm_am_excute_state_handler(Int32 state)
{
	AM_TRACE("mbm_am_excute_state_handler");
	if(g_am_state_handler != NULL)
	{
		g_am_state_handler(state, 0);
	}
}

#endif /* MBM_IMIBASE_SUPPORT */
